package com.fabiodocarmo.calendario.dao;
/**
 * @author Taciano Morais Silva
 * @version 15/10/2008
 * @since 15/10/2008
 */
import java.util.List;

import com.fabiodocarmo.calendario.beans.Bean;
import com.fabiodocarmo.calendario.dao.util.DataAccessLayerException;

public interface Dao<T extends Bean> {

    /**
     * Insert a new Event into the database.
     *
     * @param event
     */
    void create(T bean) throws DataAccessLayerException;

    /**
     * Updates the state of a detached Event.
     *
     * @param bean
     */
    void update(T bean) throws DataAccessLayerException;

    /**
     * Delete a detached Event from the database.
     *
     * @param event
     */
    void delete(T bean) throws DataAccessLayerException;

    /**
     * Delete a detached Event from the database.
     *
     * @param id
     */
    void delete(Integer id) throws DataAccessLayerException;

    /**
     * Find an object by its primary key.
     *
     * @param id
     * @return
     */
    T find(Integer id) throws DataAccessLayerException;

    /**
     * Finds all Events in the database.
     *
     * @return
     */
    List<T> findAll() throws DataAccessLayerException;

}
